﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using ZLDC.Common.Estate;

namespace ZLDC.Estate.PM
{
    public partial class HousingManagerSearch : _PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadParamType(sFitment, true, "装修");
                ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadParamType(sHouseStyle, true, "样式");
                ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadParamType(sDirect, true, "朝向");
                ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadParamType(sType, true, "类型");
                ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadParamType(infoFrom, false, "来源");
                infoFrom.Items.Insert(0, "全部");
                //ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadUsage(sUsage, true, "用途");

                LoadCity2();

                var isUsage = _Session.GetSession("isUsage");                           // 用于前台列表动态列 0表示登录者为住宅业务员 1表示登录者为商铺业务员
                string UsageTypeIDList = _Session.GetSession("UsageTypeIDList");        // 如1,4 表示 住宅、商住的权限(1住宅 2商铺 3写字楼 4商住 5仓库 6厂房 7地皮 8项目盘 9其他* 10民房)

                // 1 超级管理员
                if (info.m_sRoleID != "1")
                {
                    // 根据登录的用户类型 0表示登录者为住宅业务员 1表示登录者为商铺业务员
                    if (isUsage == "0")
                        rbUsageType1.Checked = true;
                    else
                        rbUsageType3.Checked = true;

                    // 根据用户授权的用途权限，默认选中哪个类别  rbUsageType1住宅 rbUsageType2写字楼 rbUsageType3商铺 rbUsageType4厂房 rbUsageType5民房  
                    if (UsageTypeIDList.Contains("1"))
                        rbUsageType1.Visible = true;
                    if (UsageTypeIDList.Contains("3"))
                        rbUsageType2.Visible = true;
                    if (UsageTypeIDList.Contains("2"))
                        rbUsageType3.Visible = true;
                    if (UsageTypeIDList.Contains("6"))
                        rbUsageType4.Visible = true;
                    if (UsageTypeIDList.Contains("10"))
                        rbUsageType5.Visible = true;
                }
                else
                {
                    rbUsageType1.Visible = true;
                    rbUsageType2.Visible = true;
                    rbUsageType3.Visible = true;
                    rbUsageType4.Visible = true;
                    rbUsageType5.Visible = true;
                }
            }
        }

        /// <summary>
        /// 加载城区
        /// </summary>
        private void LoadCity2()
        {
            ZLDC.Topo.BLL.Estate.AreaBLL.LoadCity(sCity2, 1);
            ListItem item1 = new ListItem("全部", "0");
            sCity2.Items.Insert(0, item1);
        }

    }
}
